<?php
/*
 * File: switch.php
 * Created: 18 июня 2007
 * Author: Andrew Dashin <dash@andrewdashin.com>
 * 
 * Description:
 * 
 * This is main switch.
 */

$service = isset($_GET['service']) ? $_GET['service'] :
         (isset($_POST['service']) ? $_POST['service'] : '');
         $action  = isset($_GET['action']) ? $_GET['action'] : '';

if ($service == '' ) {
    switch ($action) {
        case 'confirmation' :
            require (INCLUDES . 'actions/confirmation.php');
            $mainTpl = TEMPLATES . 'confirmation.tpl';
            break;
        case 'registration' :
            $mainTpl = TEMPLATES . 'registration.tpl';
            break;
        case 'reset' :
            $mainTpl = TEMPLATES . 'reset.tpl';
            break;
        default : 
            if (isset($_SESSION['userid']) || MULTYUSER == false) {
                $mainTpl = TEMPLATES . 'main.tpl';
            } else {
                $mainTpl = TEMPLATES . 'login.tpl';
            }
           break;
    }

    require ($mainTpl);
    exit(0);
}

switch ($service) {
	case 'login' :
        require ('includes/services/login.php');
        break;
    case 'logout' :
        require ('includes/services/logout.php'); 
        break;
    case 'reset' :
        require ('includes/services/reset.php'); 
        break;
    case 'registration' :
        require ('includes/services/registration.php');
        break;
}
?>
